package com.zhj.common.core.util;

import com.zhj.common.core.result.Result;
import com.zhj.common.core.result.enums.Codes;

/**
 * @author zhj
 */
public class ResultUtils {

    public static Result createSuccess(Object data) {
        return new Result(Codes.SUCCESS.code, Codes.SUCCESS.msg, data);
    }

    public static Result createFail(Codes codes) {
        return new Result(codes.code, codes.msg, null);
    }

    public static Result createFail(Codes codes, Object data) {
        return new Result(codes.code, codes.msg, data);
    }

    public static Result createFail(Integer code, String msg) {
        return new Result(code, msg, null);
    }

    public static Result create(Integer code, String msg, Object data) {
        return new Result(code, msg, data);
    }
}
